from ape import accounts, project, networks
# from dotenv import load_dotenv
import os

# load_dotenv()

def main():

    with networks.ethereum.quicknode.use_provider("sepolia"):
        # 使用默认账户进行部署
        account = accounts.load("account_0")

        # 部署 RandomNumber 合约
        random_number = account.deploy(project.RandomNumber)
        print("RandomNumber deployed to:", random_number.address)

        # 部署 Message 合约
        message = account.deploy(project.Message)
        print("Message deployed to:", message.address)

        # 部署 CurrencyBrokers 合约
        currency_brokers = account.deploy(project.CurrencyBrokers)
        print("CurrencyBrokers deployed to:", currency_brokers.address)

        # 部署 TaskEvaluation 合约
        task_evaluation = account.deploy(project.TaskEvaluation, random_number.address)
        print("TaskEvaluation deployed to:", task_evaluation.address)

        # 部署 Currency 合约
        currency = account.deploy(project.Currency, currency_brokers.address)
        print("Currency deployed to:", currency.address)

        # 部署 HelperImformation 合约
        helper_imformation = account.deploy(project.HelperImformation)
        print("HelperImformation deployed to:", helper_imformation.address)

        # 部署 Task 合约
        task = account.deploy(
            project.Task,
            message.address,
            currency_brokers.address,
            task_evaluation.address,
            helper_imformation.address
        )
        print("Task deployed to:", task.address)

        # 部署 FinishTask 合约
        finish_task = account.deploy(project.FinishTask, task.address)
        print("FinishTask deployed to:", finish_task.address)

if __name__ == "__main__":
    main()